import Vue from 'vue';
//配置路由
import VueRouter from 'vue-router'

Vue.use(VueRouter);
//1.创建组件
import Index from '@/views/index'
import Home from '@/views/home'
import Login from '@/views/login'
import NotFound from '@/views/404'
import UpdatePassword from '@/views/update-password'
import pay from '@/views/pay'
import register from '@/views/register'
import center from '@/views/center'
import jijie from '@/views/modules/jijie/list'
import news from '@/views/modules/news/list'
import discusstizhishipu from '@/views/modules/discusstizhishipu/list'
import discussjieduanshipu from '@/views/modules/discussjieduanshipu/list'
import jieduanshipu from '@/views/modules/jieduanshipu/list'
import discussjijieshipu from '@/views/modules/discussjijieshipu/list'
import zhiyeleixing from '@/views/modules/zhiyeleixing/list'
import zhiyeshipu from '@/views/modules/zhiyeshipu/list'
import storeup from '@/views/modules/storeup/list'
import users from '@/views/modules/users/list'
import tizhishipu from '@/views/modules/tizhishipu/list'
import nianlingleixing from '@/views/modules/nianlingleixing/list'
import yonghu from '@/views/modules/yonghu/list'
import jijieshipu from '@/views/modules/jijieshipu/list'
import tizhileixing from '@/views/modules/tizhileixing/list'
import discusszhiyeshipu from '@/views/modules/discusszhiyeshipu/list'
import config from '@/views/modules/config/list'


//2.配置路由   注意：名字
const routes = [{
    path: '/index',
    name: '首页',
    component: Index,
    children: [{
        // 这里不设置值，是把main作为默认页面
        path: '/',
        name: '首页',
        component: Home,
        meta: {icon: '', title: 'center'}
    }, {
        path: '/updatePassword',
        name: '修改密码',
        component: UpdatePassword,
        meta: {icon: '', title: 'updatePassword'}
    }, {
        path: '/pay',
        name: '支付',
        component: pay,
        meta: {icon: '', title: 'pay'}
    }, {
        path: '/center',
        name: '个人信息',
        component: center,
        meta: {icon: '', title: 'center'}
    }
        , {
            path: '/jijie',
            name: '季节',
            component: jijie
        }
        , {
            path: '/news',
            name: '健康知识',
            component: news
        }
        , {
            path: '/discusstizhishipu',
            name: '体质食谱评论',
            component: discusstizhishipu
        }
        , {
            path: '/discussjieduanshipu',
            name: '阶段食谱评论',
            component: discussjieduanshipu
        }
        , {
            path: '/jieduanshipu',
            name: '阶段食谱',
            component: jieduanshipu
        }
        , {
            path: '/discussjijieshipu',
            name: '季节食谱评论',
            component: discussjijieshipu
        }
        , {
            path: '/zhiyeleixing',
            name: '职业类型',
            component: zhiyeleixing
        }
        , {
            path: '/zhiyeshipu',
            name: '职业食谱',
            component: zhiyeshipu
        }
        , {
            path: '/storeup',
            name: '我的收藏管理',
            component: storeup
        }
        , {
            path: '/users',
            name: '管理员',
            component: users
        }
        , {
            path: '/tizhishipu',
            name: '体质食谱',
            component: tizhishipu
        }
        , {
            path: '/nianlingleixing',
            name: '年龄类型',
            component: nianlingleixing
        }
        , {
            path: '/yonghu',
            name: '用户',
            component: yonghu
        }
        , {
            path: '/jijieshipu',
            name: '季节食谱',
            component: jijieshipu
        }
        , {
            path: '/tizhileixing',
            name: '体质类型',
            component: tizhileixing
        }
        , {
            path: '/discusszhiyeshipu',
            name: '职业食谱评论',
            component: discusszhiyeshipu
        }
        , {
            path: '/config',
            name: '轮播图管理',
            component: config
        }
    ]
},
    {
        path: '/login',
        name: 'login',
        component: Login,
        meta: {icon: '', title: 'login'}
    },
    {
        path: '/register',
        name: 'register',
        component: register,
        meta: {icon: '', title: 'register'}
    },
    {
        path: '/',
        name: '首页',
        redirect: '/index'
    }, /*默认跳转路由*/
    {
        path: '*',
        component: NotFound
    }
]
//3.实例化VueRouter  注意：名字
const router = new VueRouter({
    mode: 'history',
    /*hash模式改为history*/
    routes // （缩写）相当于 routes: routes
})

export default router;
